import type { BaseResponse_int_ } from "../models/BaseResponse_int_";
import type { BaseResponse_List_ContestSubmit_ } from "../models/BaseResponse_List_ContestSubmit_";
import type { BaseResponse_long_ } from "../models/BaseResponse_long_";
import type { QuestionSubmitAddRequest } from "../models/QuestionSubmitAddRequest";

import type { CancelablePromise } from "../core/CancelablePromise";
import { OpenAPI } from "../core/OpenAPI";
import { request as __request } from "../core/request";

export class ContestSubmitControllerService {
  /**
   * getUserQuestionAttempts
   * @param contestId contestId
   * @param questionId questionId
   * @returns BaseResponse_int_ OK
   * @throws ApiError
   */
  public static getUserQuestionAttemptsUsingGet(
    contestId?: number,
    questionId?: number
  ): CancelablePromise<BaseResponse_int_> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/contest_submit/attempts",
      query: {
        contestId: contestId,
        questionId: questionId,
      },
      errors: {
        401: `Unauthorized`,
        403: `Forbidden`,
        404: `Not Found`,
      },
    });
  }

  /**
   * doContestSubmit
   * @param questionSubmitAddRequest questionSubmitAddRequest
   * @param contestId contestId
   * @returns BaseResponse_long_ OK
   * @returns any Created
   * @throws ApiError
   */
  public static doContestSubmitUsingPost(
    questionSubmitAddRequest: QuestionSubmitAddRequest,
    contestId?: number
  ): CancelablePromise<BaseResponse_long_ | any> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/contest_submit/do",
      query: {
        contestId: contestId,
      },
      body: questionSubmitAddRequest,
      errors: {
        401: `Unauthorized`,
        403: `Forbidden`,
        404: `Not Found`,
      },
    });
  }

  /**
   * getUserContestSubmits
   * @param contestId contestId
   * @returns BaseResponse_List_ContestSubmit_ OK
   * @throws ApiError
   */
  public static getUserContestSubmitsUsingGet(
    contestId?: number
  ): CancelablePromise<BaseResponse_List_ContestSubmit_> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/contest_submit/list",
      query: {
        contestId: contestId,
      },
      errors: {
        401: `Unauthorized`,
        403: `Forbidden`,
        404: `Not Found`,
      },
    });
  }

  /**
   * getUserSolvedCount
   * @param contestId contestId
   * @returns BaseResponse_int_ OK
   * @throws ApiError
   */
  public static getUserSolvedCountUsingGet(
    contestId?: number
  ): CancelablePromise<BaseResponse_int_> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/contest_submit/solved",
      query: {
        contestId: contestId,
      },
      errors: {
        401: `Unauthorized`,
        403: `Forbidden`,
        404: `Not Found`,
      },
    });
  }
}
